# SQL debug logs

**Jitsu** support SQL debug logs: DDL statements as well as CRUD queries.
This feature is disabled by default. For enabling it - fill `sql_debug_log` section in the configuration:

```yaml
sql_debug_log:
  ddl:
    enabled: true #default value
    path: <sql_debug_log_path_directory> or "global" constant
    rotation_min: 10 # optional, default is 5 minutes. If set 0, 24 hours would be kept
    max_backups: 20 # optional, log files won't be deleted if not set
  queries:
    enabled: false #default value
    path: <sql_debug_log_path_directory> or "global" constant
    rotation_min: 10 # optional, default is 5 minutes. If set 0, 24 hours would be kept
    max_backups: 20 # optional, log files won't be deleted if not set
```

There are two sections with the same parameters - _ddl_ and _queries._ Depending on what section is configured, the logger writes only DDL, only CRUD, or both types of queries. If both types of logging are configured to write to the same directory, DDL logs will have _\*-ddl-debug\*_ name pattern and CRUD logs will have _\*-sql-debug\*_ names.

<table>
  <thead>
    <tr>
      <th>
        <em>Field</em>
      </th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <b>path</b>
        <br />
        <em>(required)</em>
      </td>
      <td>
        For writing SQL debug logs to global application logs use the constant:{" "}
        <b>global</b>. For writing to separate files use a path to the dir
      </td>
    </tr>
    <tr>
      <td>
        <b>enabled</b>
      </td>
      <td>
        Enable or disable logger. SQL Queries log which contains all SQL insert
        statements can consume a lot of disk space, So it is disabled by
        default.
      </td>
    </tr>
    <tr>
      <td>
        <b>rotation_min</b>
      </td>
      <td>
        How often files should be rotated (will be ignored if <b>global</b>)
      </td>
    </tr>
    <tr>
      <td>
        <b>max_backups</b>
      </td>
      <td>
        How many old log files should be kept. By default, all old log files
        will be kept. (will be ignored if <b>global</b>)
      </td>
    </tr>
  </tbody>
</table>
